let app = getApp();
let iconUrl = 'https://atush.vip/static/icons/';

Component({
    /**
     * 组件的属性列表
     */
    properties: {
        
    },

    /**
     * 组件的初始数据
     */
    data: {
        lang: null,
        iconUrl: iconUrl,
        select_list: [
            {id: 0, name: 'house', icon: iconUrl + 'oy.svg'},
            {id: 1, name: 'car', icon: iconUrl + 'car.svg' },
            {id: 2, name: 'jobs', icon: iconUrl + 'hizmet.svg' },
            {id: 3, name: 'usedGoods', icon: iconUrl +'nimKaxBuyum.svg' },
            {id: 4, name: 'experts', icon: iconUrl +'ailaSaymanRimunt.svg' },
            {id: 5, name: 'service', icon: iconUrl +'sodaSetik.svg' }
        ]
    },

    /**
     * 组件的方法列表
     */
    methods: {
        // 点击添加属性
        onSelectListClick(e) {
            let index = e.currentTarget.dataset.index
            let currentIndex;
            switch (index) {
                case 0:
                    currentIndex = 2;
                    wx.navigateTo({
                        url: '/pages/home/house/house?currentIndex=' + currentIndex
                    });
                    break;
                case 1:
                    currentIndex = 1;
                    wx.navigateTo({
                        url: '/pages/home/car/car?currentIndex=' + currentIndex
                    });
                    break;
                case 2:
                    currentIndex = 2;
                    wx.navigateTo({
                        url: '/pages/home/jobs/jobs?currentIndex=' + currentIndex
                    });
                    break;
                case 3:
                    currentIndex = 1;
                    wx.navigateTo({
                        url: '/pages/home/secondHand/secondHand?currentIndex=' + currentIndex
                    });
                    break;
                case 4:
                    currentIndex = 1;
                    wx.navigateTo({
                        url: '/pages/home/maintenance/maintenance?currentIndex=' + currentIndex
                    });
                    break;
                case 5:
                    currentIndex = 1;
                    wx.navigateTo({
                        url: '/pages/home/buyAndSell/buyAndSell?currentIndex=' + currentIndex
                    });
                    break;
                default:
                    break;
            }
        },

        // 关闭发布选项页面
        onCloseClick() {
            wx.navigateTo({
                url: '/pages/index/index'
            });
        },
    },
    lifetimes: {
        attached: function() {
            this.setData({ lang: app.globalData.lang })
        },
    }
})
